<template>
  <div class="teacher_info">
    <custom-title title="用户资料"  />
    <el-descriptions
      style="margin-top: 20px; margin-bottom: 20px"
      :column="1"
      border
      label-width="110px"
    >
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">用户ID</div>
        </template>
        {{ props?.data?.user_id }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">姓名</div>
        </template>
        {{ props?.data?.real_name }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">联系方式</div>
        </template>
        {{ props?.data?.phone }}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">邮箱</div>
        </template>
        {{ props?.data?.email }}
      </el-descriptions-item>

      <el-descriptions-item label-class-name="desc_label_120">
        <template #label>
          <div class="cell-item">院系/班级</div>
        </template>
        {{ props?.data?.college?.name }}
      </el-descriptions-item>

      <el-descriptions-item>
        <template #label>
          <div class="cell-item">创建时间</div>
        </template>
        {{props?.data?.created_at}}
      </el-descriptions-item>

      <el-descriptions-item>
        <template #label>
          <div class="cell-item">最近登录时间</div>
        </template>
        {{props?.data?.updated_at}}
      </el-descriptions-item>
    </el-descriptions>

    <custom-title title="统计信息" />

    <el-descriptions  label-width="110px" style="margin-top: 20px" :column="1" border>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">作品总数</div>
        </template>
        {{props?.data?.works_num}}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">优秀作品数</div>
        </template>
        {{props?.data?.fine_works_num}}
      </el-descriptions-item>
      <el-descriptions-item>
        <template #label>
          <div class="cell-item">对话总数</div>
        </template>
        {{props?.data?.dialogue_num}}
      </el-descriptions-item>

      <el-descriptions-item>
        <template #label>
          <div class="cell-item">创作总数</div>
        </template>
        {{props?.data?.creation_num}}
      </el-descriptions-item>

    </el-descriptions>
  </div>
</template>

<script setup lang="ts">
import { computed, ref } from "vue";
import customTitle from "@/components/custom-title/index.vue";
 
import type { ComponentSize } from "element-plus";

const size = ref<ComponentSize>("default");
// 接收父组件的props
const props = defineProps<{
  data?: any;
}>();

const iconStyle = computed(() => {
  const marginMap = {
    large: "8px",
    default: "6px",
    small: "4px",
  };
  return {
    marginRight: marginMap[size.value] || marginMap.default,
  };
});
const blockMargin = computed(() => {
  const marginMap = {
    large: "32px",
    default: "28px",
    small: "24px",
  };
  return {
    marginTop: marginMap[size.value] || marginMap.default,
  };
});
</script>

<style scoped>
.cell-item {
  display: flex;
  align-items: center;
}

.teacher_info {
  background: white;
  padding: 20px;
}
</style>
